//
//  WDControllerUtil.m
//  testApp
//
//  Created by iMac on 2018/2/10.
//  Copyright © 2018年 iMac. All rights reserved.
//

#import "WDControllerUtil.h"


@implementation WDControllerUtil


    

+ (void)setAFullScreenScrollViewFrame:(UIScrollView *)scrollView controller:(UIViewController *)controller hasStatus:(BOOL)hasStatus hasNav:(BOOL)hasNav hasTabar:(BOOL)hasTabar {
    if (@available(iOS 11, *)) {
        scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic;
    } else {
        controller.automaticallyAdjustsScrollViewInsets = NO;
    }
    CGFloat x = 0;
    CGFloat y = 0;
    CGFloat width = 0;
    CGFloat height = 0;
    if (hasStatus) {
        y += [UIApplication sharedApplication].statusBarFrame.size.height;
    }
    if (hasNav) {
        y += controller.navigationController.navigationBar.frame.size.height;
    }
    width = [UIScreen mainScreen].bounds.size.width;
    height = [UIScreen mainScreen].bounds.size.height - y;
    if (hasTabar) {
        height -= controller.tabBarController.tabBar.frame.size.height;
    }
    scrollView.frame = CGRectMake(x, y, width, height);
}


@end
